package org.iocdemo.springiocdemo;

import org.iocdemo.springiocdemo.component.StudentComponent;
import org.iocdemo.springiocdemo.component.UserComponent;
import org.iocdemo.springiocdemo.config.UserConfiguration;
import org.iocdemo.springiocdemo.controller.UserController;
import org.iocdemo.springiocdemo.model.Student;
import org.iocdemo.springiocdemo.rep.UserRepository;
import org.iocdemo.springiocdemo.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringIocDemoApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringIocDemoApplication.class, args);
//        context.getBean(UserComponent.class).print();
//        context.getBean(UserConfiguration.class).print();
//        context.getBean(UserService.class).print();
//        context.getBean(UserComponent.class).print();
//        context.getBean(UserRepository.class).print();
//        Student s = (Student) context.getBean("s1");
//        System.out.println(s);
//        Student s1 = (Student) context.getBean("s2");
//        System.out.println(s1);
//        StudentComponent studentComponent = new StudentComponent();
//        System.out.println(studentComponent.student);

//        System.out.println(context.getBean(Student.class));
        UserController bean = context.getBean(UserController.class);
        bean.print();

    }

}
